/**
 * Created by Administrator on 2017/8/4.
 */


import React,{Component} from 'react'
import {TouchableOpacity,Image,Text,StyleSheet,FlatList,Dimensions,View} from 'react-native'

import AddView from './AddGoodsPopup'

const ScreenSize = {
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height
};
const styles = StyleSheet.create({
    ll:{
        height:157,
        flex:1/3,
        alignItems:'center',backgroundColor:'#fff'
    },
    img:{
        width:89,
        height:80,
        marginTop:22
    },
    tv:{
        fontSize:14,
        color:'#333',
        marginTop:22
    }
})

let ItemImg = require('../Img/icon.png')

export default class Replenishment extends Component{

    constructor(props){
        super(props)
        this.state = {
            listData:[{},{},{},{},{},{},{}],
            visible:false,
            popupObj:{}
        }
    }
    render(){
        let dialog = this.state.visible ? <AddView isShow={this.state.visible} dismiss={()=>this.setState({visible:false})}/> :null
        return(
        <View style={{flex:1}}>

            <FlatList
                data={this.state.listData}
                numColumns={3}
                renderItem={({item}) => this._renderItem(item)}/>
            {dialog}
        </View>

        )
    }

    _renderItem(item){
        return(
            <TouchableOpacity style={styles.ll}
                              onPress={()=>this.setState({visible:true})}>
                <Image style={styles.img} source={ItemImg}/>
                <Text style={styles.tv}>餐巾纸</Text>
            </TouchableOpacity>
        )
    }


}